<?php 

?>

<h3 class="header-with-margins  colored-header"><?= $this->translate('Email Delivery'); ?></h3>

<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
	<?php foreach ($config['templateTypes'] as $type => $value):?>
		<li role="presentation" class="<?php echo ($value['isActive']) ? 'active' : ''; ?>">
			<a href="#<?php echo strtolower($type); ?>" aria-controls="<?php echo $type; ?>" role="tab" data-toggle="tab">
				<?php echo $this->translate($value['title']); ?>
			</a>
		</li>
	<?php endforeach; ?>
</ul>

<!-- Tab panes -->
<div class="tab-content ml-tab-content">
	<?php foreach ($config['templateTypes'] as $type => $value):?>
		
		<?php $action = $this->action($value['action'], $value['defaultParams'], null, null, true); ?>
		
		<div role="tabpanel" class="panel_item tab-pane <?php echo ($value['isActive']) ? 'active' : ''; ?>" id="<?php echo strtolower($type); ?>">
			<table class="table table-hover">
				<tr>
					<td><?php echo $this->translate('Title'); ?>:</td>
					<td><?php echo $action->get('title'); ?></td>
				</tr>
				<tr>
					<td><?php echo $this->translate('From'); ?>:</td>
					<td>
						<?php echo $from = $action->get('from') 
							? $action->get('from') 
							: $value['defaultAddressFrom']; 
						?>
					</td>
				</tr>
				<tr>
					<td><?php echo $this->translate('To'); ?>:</td>
					<td><?php echo $action->get('to'); ?></td>
				</tr>
			</table>
			<iframe class="admin-mail-frame" srcdoc="<?php echo htmlspecialchars($action->content); ?>" width="100%" height="475px">
			no iframe
			</iframe>
		</div>
	<?php endforeach; ?>
</div>